home *** CD-ROM | disk | FTP | other *** search
- {X+,V-,B-}
-
- program ChkAtt;
-
- { Example for the nwConn unit/ NwTP 0.6 API. (c) 1993,1995, R. Spronk }
-
- uses nwMisc,nwBindry,nwConn;
-
- Var srvr,usr:string;
- connId,PrConnId:Byte;
- MyObjName:string;
- MyObjType:word;
- MyObjId:Longint;
- accLev:byte;
-
- begin
- if ParamCount<>2
- then begin
- writeln('CHKATT - Batch file utility to check for an attachment.');
- writeln;
- writeln('Supply 2 parameters : CHKATT <servername> <username>');
- writeln('If attached/logged on : ChkAtt returns errorlevel 0');
- writeln('in *all* other circumstances, errorlevel 1 will be returned.');
- halt(1);
- end;
- srvr:=ParamStr(1);UpString(srvr);
- Usr:=paramStr(2);UpString(usr);
- IF NOT GetConnectionId(srvr,connId)
- then halt(1);
- { ok.. attachment to <servername> exists... am I logged in as <username> ? }
- GetPreferredConnectionId(prConnId);
- SetPreferredConnectionId(connId);
- IF GetBinderyAccessLevel(accLev,MyObjId)
- and GetBinderyObjectName(MyObjId,MyObjName,MyObjType)
- and (MyObjName=usr)
- then begin
- SetPreferredConnectionId(PrConnId);
- halt(0);
- end
- else begin
- SetPreferredConnectionId(PrConnId);
- halt(1);
- end
- end.